/*************************************************************************
	> File Name: P1572.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-03-18 10:11:02
 ************************************************************************/
#include <iostream>
#include <queue>
using namespace std;

int gcd(int a, int b) {
    return (b ? gcd(b, a % b) : a);
}

int lcm(int a, int b) {
    return a / gcd(a, b) * b;
}

string calc(queue<int> &q1, queue<int> &q2, queue<char> &opt) {
    int a = q1.front(), b = q2.front();
    q1.pop(), q2.pop();
    int temp = gcd(a, b);
    a /= temp;
    b /= temp;
    while (!opt.empty()) {
        int x = q1.front();
        int y = q2.front();
        q1.pop(), q2.pop();
        int val = lcm(b, y);
        a *= (val / b);
        x *= (val / y);
        char ch = opt.front();
        opt.pop();
        switch (ch) {
            case '+': a = a + x; break;
            case '-': a = a - x; break;
        }
        b = val;
        int k = gcd(a, b);
        a = a / k;
        b = b / k;
    }
    if (a % b == 0) return to_string(a / b);
    if ((a < 0 && b < 0) || (a > 0 && b < 0)) {
        a *= -1;
        b *= -1;
    }
    return to_string(a) + "/" + to_string(b);
}

int main() {
    queue<int> q1, q2;
    queue<char> opt;
    string str;
    cin >> str;
    int num = 0, flag = 1;
    for (int i = 0; i < str.size(); i++) {
        if (i == 0 && str[i] == '-') {
            flag = -1;
            continue;
        }
        switch (str[i]) {
            case '/': {
                q1.push(num);
                num = 0;
            } break;
            case '+': 
            case '-': {
                q2.push(num);
                opt.push(str[i]);
                num = 0;
            } break;
            default: 
                num = num * 10 + str[i] - '0';
                num *= flag;
                flag = 1;
        }
    }
    if (num) q2.push(num);
    cout << calc(q1, q2, opt) << endl;
    return 0;
}
